package com.foo.designpattern.factory.simplefactorypattern;

import junit.framework.Assert;
import junit.framework.TestCase;

/**
 * com.foo.designpattern.factory.simplefactorypattern
 * Created with IntelliJ IDEA.
 * User: wangyuxi
 * DateTime: 2016/4/1720:38
 *
 * @desc
 */
public class SimpleFactoryTestCase extends TestCase {
    //测试中国人
    public void testNormalSimpleFactory1() {
        People p = PeopleFactory.create(1);
        Assert.assertEquals("说中国话", p.say());
    }

    //测试美国人
    public void testNormalSimpleFactory2() {
        People p = PeopleFactory.create(2);
        Assert.assertEquals("speak english", p.say());
    }

    //测试除了中国人和美国人的其他人，此处一定会报异常
    public void testNotNormalSimpleFactory() {
        People p = PeopleFactory.create(3);
        Assert.assertEquals("speak english", p.say());
    }


}
